/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.losalpes.catalogo.servicios.areas;

import com.losalpes.catalogo.utilidades.ReadWriteTextFile;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.ejb.Stateless;

/**
 *
 * @author am.ocampo256
 */
@Stateless
public class CallCenterBean implements CallCenterRemote, CallCenterLocal {
    
    // Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Business Method" or "Web Service > Add Operation")

    public void printLogMessage(String muebleReferencia, String muebleNombre, Long promocionFechaInicial, Long promocionFechaFinal, String texto) {
        File file = null;
        SimpleDateFormat sdfDate = new SimpleDateFormat("dd/MM/yyyy");
        SimpleDateFormat sdfHour = new SimpleDateFormat("hh:mm");
        StringBuffer stringBuffer = null;
        try {
            file = new File("C:\\log4j\\log4jCallCenterBean.txt");
            stringBuffer = file.createNewFile() ? new StringBuffer() : ReadWriteTextFile.getContentFile(file);
            stringBuffer.append("CallCenterBean:printLogMessage:Date:" + sdfDate.format(new Date()) + ":Hour:" + sdfHour.format(new Date()) + ":promocionFechaInicial:" + new Date(promocionFechaInicial) + ":promocionFechaFinal:" + new Date(promocionFechaFinal) + ":texto:" + texto);
            ReadWriteTextFile.setContentFile(file, stringBuffer);
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
}
